package com.ruoyi.project.bus.compare.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.bus.compare.domain.BusCompare;
import com.ruoyi.project.bus.compare.mapper.BusCompareMapper;
import com.ruoyi.project.bus.compare.service.IBusCompareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * compareService业务层处理
 * 
 * @author ruoyi
 * @date 2020-11-28
 */
@Service
public class BusCompareServiceImpl implements IBusCompareService 
{
    @Autowired
    private BusCompareMapper busCompareMapper;

    /**
     * 查询compare
     * 
     * @param id compareID
     * @return compare
     */
    @Override
    public BusCompare selectBusCompareById(Long id)
    {
        return busCompareMapper.selectBusCompareById(id);
    }

    /**
     * 查询compare列表
     * 
     * @param busCompare compare
     * @return compare
     */
    @Override
    public List<BusCompare> selectBusCompareList(BusCompare busCompare)
    {
        return busCompareMapper.selectBusCompareList(busCompare);
    }

    /**
     * 新增compare
     * 
     * @param busCompare compare
     * @return 结果
     */
    @Override
    public int insertBusCompare(BusCompare busCompare)
    {
        busCompare.setCreateTime(DateUtils.getNowDate());
        return busCompareMapper.insertBusCompare(busCompare);
    }

    /**
     * 修改compare
     * 
     * @param busCompare compare
     * @return 结果
     */
    @Override
    public int updateBusCompare(BusCompare busCompare)
    {
        busCompare.setUpdateTime(DateUtils.getNowDate());
        return busCompareMapper.updateBusCompare(busCompare);
    }

    /**
     * 删除compare对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBusCompareByIds(String ids)
    {
        return busCompareMapper.deleteBusCompareByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除compare信息
     * 
     * @param id compareID
     * @return 结果
     */
    @Override
    public int deleteBusCompareById(Long id)
    {
        return busCompareMapper.deleteBusCompareById(id);
    }
}
